// 用户信息模块文件 user.js
import { SET_USERINFO } from "@/types/mutation-types";
// window.console.log(SET_USERINFO);
const state = {
    token: ''
};
const mutations = {
    [SET_USERINFO]: function (state, payload) {
        const { token } = payload;
        //使用结构赋值简化代码
        state.token = token;
    },
};

const actions = {
    [SET_USERINFO]: function ({ commit }, payload) {
        commit(SET_USERINFO, {
            //以载荷形式提交
            token: payload.token,
        });
    },
};
export default {
    namespaced: true,
    state,
    mutations,
    actions,
};

